<html>
<head>
    <title>Help On LaTeX fragile commands</title>
    <link rel="stylesheet" type="text/css" title="Help with LaTeX" href="latex.css">
</head>
<body>

<h3>Hypertext Help with LaTeX</h3>

<h2>Fragile and Robust commands</h2>

<p>LaTeX commands are either <em>robust</em> or <em>fragile</em>.
    Fragile commands need special care <em>if they are part of a
        moving argument</em>.</p>

<p>Arguments to some LaTeX commands are called <em>moving
    arguments</em> because they may be "moved" to other places in
    the document. For example, the argument of
    <a href="ltx-141.html">Sectioning comands</a> may be moved to
    the <a href="ltx-170.html">Table of Contents</a>. Other
    examples of moving arguments include:</p>

<ul>
    <li>arguments of <tt><a href="caption.html">\caption</a></tt> commands</li>
    <li>terminal input and output, <tt><a href="ltx-174.html">\typeout</a></tt>
        and <tt><a href="ltx-175.html">\typein</a></tt></li>
    <li>commands that <a href="ltx-264.html">produce page headings</a></li>
    <li>the <a href="ltx-91.html">Letter Environment</a></li>
    <li>the <tt><a href="ltx-324.html">\thanks</a></tt> command</li>
    <li> an <tt>@</tt> expression in the <a href="ltx-202.html">Array</a> or
        <a href="ltx-68.html">Tabular</a> environment
    </li>
</ul>

<p>A fragile command that appears in a moving argument must be
    preceded by a <tt>\protect</tt> command. The <tt>\protect</tt>
    applies only to the immediately following command; if arguments
    of this command also contain fragile commands, the latter must
    be protected with their own <tt>\protect</tt>.</p>

<h3>Some fragile commands</h3>

<p>The following list is not exhaustive, but illustrates the
    kind of commands which are fragile</p>

<ul>
    <li>All commands that have an optional argument are fragile.</li>
    <li>Environments delimited by <tt>\begin ... \end</tt> are fragile.</li>
    <li><a href="ltx-421.html">Display math</a> environment
        delimited by <tt>\[ ... \]</tt></li>
    <li><a href="ltx-115.html">Math environment</a> <tt>\( ... \)</tt>
        <ul>
            <li>However, <tt>$ ... $</tt> is robust</li>
        </ul>
    </li>
    <li>Line breaks, <tt><a href="ltx-181.html">\\</a></tt></li>
    <li><tt><a href="item.html">\item</a></tt> commands</li>
    <li><tt><a href="ltx-231.html">\footnote</a></tt> commands</li>
</ul>

<h3>Some robust commands</h3>

<p>In general, commands which change <a href="ltx-176.html">Type
    face or Type style</a> are robust.</p>

<p><a href="ltx-86.html">Length commands</a> are robust and should
    <strong>not</strong> be preceded by a <tt>\protect</tt> command. Nor
    should a <tt>\protect</tt> command be used in the argument to
    <tt><a href="ltx-195.html">\addtocounter</a></tt> or
    <tt><a href="ltx-310.html">\setcounter</a></tt> command.</p>

<hr noshade="noshade" size="1">

<p>Return to <a href="ltx-2.html">LaTeX Table of Contents</a></p>

<hr noshade="noshade" size="1">
<address>
    Revised 29 Sep 1995.
</address>
</body>
</html>
